// debug.ts
class Debug {
  // 全局调试开关
  private static _enabled: boolean = false;

  /** 是否启用，默认true */
  static enable(enabled: boolean = true): void {
    this._enabled = enabled;
  }

  static log(namespace: string, ...args: any[]): void {
    if (!this._enabled) return;
    console.log(`[${namespace}]`, ...args);
  }

  static warn(namespace: string, ...args: any[]): void {
    if (!this._enabled) return;
    console.warn(`[${namespace}]`, ...args);
  }

  static error(namespace: string, ...args: any[]): void {
    if (!this._enabled) return;
    console.error(`[${namespace}]`, ...args);
  }

  static info(namespace: string, ...args: any[]): void {
    if (!this._enabled) return;
    console.info(`[${namespace}]`, ...args);
  }
}

export default Debug;
